package cn.janyd.jmall.userweb.controller.user;

import cn.janyd.common.core.vo.CommonResult;
import cn.janyd.jmall.userweb.controller.user.vo.UserRespVo;
import cn.janyd.jmall.userweb.manager.user.UserManager;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.janyd.common.core.vo.CommonResult.success;

/**
 * @author janyd
 * @since 2020/8/10 17:51
 */
@Api(tags = "用户 API")
@RestController
@RequestMapping("/user")
@AllArgsConstructor
public class UserController {

    private final UserManager userManager;

    @GetMapping("/{userId}")
    public CommonResult<UserRespVo> getUser(@PathVariable("userId") Integer userId) {
        return success(userManager.getUser(userId));
    }

}
